package Task3;
/**
* 通话套餐类
* 特征：通话时长、短信条数、每月资费
* 行为：显示所有套餐信息
*/
public class CallPackage extends AbstractPackage implements CallService{

    private int talkTime;   // 通话时长
    private int messageNum; // 短信条数

    public CallPackage() {
    }

    public CallPackage(int monthlyRate, int talkTime, int messageNum, int monthlyRate1) {
        super(monthlyRate);
        setTalkTime(talkTime);
        setMessageNum(messageNum);
    }

    public int getTalkTime() {
        return talkTime;
    }

    public void setTalkTime(int talkTime) {
        if(talkTime>=0) {
            this.talkTime = talkTime;
        } else {
            System.out.println("通话时长不合理哦！");
        }
    }

    public int getMessageNum() {
        return messageNum;
    }

    public void setMessageNum(int messageNum) {
        if(messageNum>=0) {
            this.messageNum = messageNum;
        } else {
            System.out.println("短信条数不合理哦！");
        }
    }

    @Override
    public void callService(int talkTime, PhoneCard phoneCard) {
        phoneCard.show();
        setTalkTime(talkTime);
        //setMessageNum();
        //setMonthlyRate();
    }

    @Override
    public void show() {
        System.out.println("CallPackage通话套餐类");
        System.out.println("通话分钟：" + getTalkTime());
        //System.out.println("短信条数：" + getMessageNum());
        //System.out.println("每月资费：" + getMonthlyRate());
    }}
